<?php

namespace app\admin\common\controller;

use app\admin\framework\api\Permission;
use app\common\service\OrderService;
use app\common\model\OrderTrip;

#[Permission('异常订单', 'Order', 6)]
class ExceptionController
{
    
    #[Permission('参数')]
    public function option()
    {
        return apiSuccess(data: [
            'status' => OrderTrip::EXCEPTION_STATUS
        ]);
    }
    
    #[Permission('查询')]
    public function select()
    {
        $status = request()->get('status');
        $list = OrderService::getLists('dept.exception', [
            'status' => $status
        ]);
        return apiSuccess(data: ['list' => $list->items(), 'total' => $list->total()]);
    }
    
    #[Permission('编辑')]
    public function update()
    {
        $id = request()->post('id', 0);
        $status = request()->post('status', 0);
        OrderService::updateExceptionStatus($id, $status);
        return apiSuccess('修改成功');
    }
    
}